package com.lanqiao.gxnushop.service;

import com.lanqiao.gxnushop.entity.Stores;
import com.lanqiao.gxnushop.mapper.StoresMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class StoresService {
    @Autowired
    private StoresMapper storesMapper;

    /**增加店铺
     * 需要传入的参数有：store（sellerId：卖家Id， name:店铺名, description:店铺描述,loginUrl:需要先进行文件上传, state:默认为1）*/
    public boolean add (Stores stores) {
        return storesMapper.add(stores);
    }

    /**通过店铺编号：storeId 删除店铺*/
    public boolean delete(String storeId){
        return storesMapper.delete(storeId);
    }
    /**通过店铺编号：storeId 修改店铺信息*/
    public boolean update(Stores stores){
        return storesMapper.update(stores);
    }

    /**精确查找某个店铺   用于管理员对店铺管理*/
    public Stores select(String storeId){
        return storesMapper.select(storeId);
    }

    /** 卖家名下的店铺*/
    public ArrayList<Stores> selectBySellerId(String sellerId){
        return storesMapper.selectBySellerId(sellerId);
    }

    /**通过店名进行模糊查找*/
    public ArrayList<Stores> selectByName(String name){
        return storesMapper.selectByName(name);
    }

    /**修改店铺图片*/
    public boolean updateStoreImg(Stores stores){
        return storesMapper.updateStoreImg(stores);
    }

}
